<!DOCTYPE html>
<html>
<head lang="en">
  <meta charset="UTF-8">
  <title></title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="format-detection" content="telephone=no">
  <meta name="renderer" content="webkit">
  <meta http-equiv="Cache-Control" content="no-siteapp" />
  <link rel="alternate icon" type="image/png" href="assets/i/favicon.png">
  <link rel="stylesheet" href="assets/css/amazeui.min.css"/>
  <style>
    .header {
      text-align: center;
    }
    .header h1 {
      font-size: 200%;
      color: #333;
      margin-top: 30px;
    }
    .text {
      padding: 8px 0px 24px;
      font-size: 120%;
      font-weight: normal;
    }
    img {
      margin-top: 10px;
      margin-left: 80px;
    }
  </style>
</head>
<body>
	<div class="header">
	  <div class="am-g">
		<?php
		require_once 'mysql.php';
		$link = connect ();
		
		$type = $_POST['type'];
		$num = $_POST['num'];
		$tags = $_POST['tags'];
		$difficulty = $_POST['difficulty'];
		$limit = $num / count ( $tags );
		
		echo '<h1>'.$type.'</h1>';
		echo '<button class="am-btn am-btn-success am-btn-xs">题目数量&nbsp;&nbsp;'.$num.'</button>&nbsp;';
		echo '<button class="am-btn am-btn-warning am-btn-xs">题目难度&nbsp;'.$difficulty.'</button>';
		
		echo '</div>';
		echo '<hr />';
		echo '</div>';
		echo '<div class="am-g">';
		echo '<div class="am-u-lg-5 am-u-sm-centered">';
		
		$num = 1;
		for($i = 0; $i < count ( $tags ); $i ++) {
			$tag = $tags [$i];
			$data = fetchQuestion($type, $tag, $limit,$difficulty);
			
			for($j = 0; $j < count ( $data); $j ++) {
				$content = $data[$j] ['content'];
				$point = $data[$j] ['tag'];
				$level = $data[$j] ['level']; //
				$img = $data[$j]['img'];
				
				echo '<button class="am-btn am-btn-danger am-btn-xs">难度：';
				echo $level;
				echo '</button>&nbsp;&nbsp;';
				echo '<button class="am-btn am-btn-secondary am-round am-btn-sm">';
				echo $point;
				echo '</button><br><div class="text">';
				echo $num++.'. '.$content;
				echo '<br>';
				
				if ($img != null){
// 					echo '<img src="'.$img.'" height="200" width="200" />';
					echo '<img src="'.$img.'" />';
				}else {
// 					echo "no img";
				}
				echo '</div>';
				echo '<hr>';
				
			}
		}
		
		mysql_close ( $link );
		?>

	  
	  </div>
	</div>
	<hr>

</body>
</html>

